package labox.innovation.gameserver.network.clientpackets;

import labox.innovation.gameserver.model.actor.instance.FuzePcInstance;
import labox.innovation.gameserver.network.SystemMessageId;
import labox.innovation.gameserver.network.serverpackets.SystemMessage;

/**
 * @author ljsh
 * @date 2010-4-2 
 * @version 1.0
 * @description 设置征友基本信息
 */
public class RequestSetInfo extends L2GameClientPacket {
	private static final String _C_RequestSetInfo = "[C] RequestSetInfo";

	private int province;// 省

	private int city;// 市

	private int isLoginTip;// 好友上线提示

	@Override
	public String getType() {

		return _C_RequestSetInfo;
	}

	@Override
	protected void readImpl() {
		province = readByte();
		city = readByte();
		isLoginTip = readByte();
	}

	@Override
	protected void runImpl() {
		FuzePcInstance instance = getClient().getActiveChar();
		if (instance == null) {
			return;
		}
		SystemMessage msg = null;
		if (province == -1 || city == -1) {
			msg = new SystemMessage(SystemMessageId.YOUR_INFO_NOT_RIGTH);
			instance.sendPacket(msg);
			return;
		} else {
			instance.getFriendInstance().setProvince(province);
			instance.getFriendInstance().setCity(city);
			instance.getFriendInstance().setIsLoginTip(isLoginTip);
			msg = new SystemMessage(SystemMessageId.YOUR_INFO_SET_SUCCESS);
			instance.sendPacket(msg);
		}

	}

}
